<template>
	<view class="setup">
		<view class="setup_menu">
			<view class="setup_item" @click="goModifyProfile">个人资料</view>
			<view class="setup_item" @click="goModifyPassword">修改密码</view>
		</view>
		<view class="layout" @click="layout">退出</view>
	</view>
</template>

<script>
	import {
		mapMutations
	} from "vuex";
	export default {
		data() {
			return {

			}
		},
		methods: {
			...mapMutations('userInfo', ['setStorage']),
			...mapMutations('cart', ['setshoppingCart']),
			layout() {
				setTimeout(() => {
					this.setStorage('')
					this.setshoppingCart([])
					uni.switchTab({
						url: '/pages/personalCenter/personalCenter'
					})
				}, 500)
			},
			goModifyProfile() {
				uni.navigateTo({
					url: '/setup/modifyProfile'
				})
			},
			goModifyPassword() {
				uni.navigateTo({
					url: '/setup/modifyPassword'
				})
			}
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: '设置'
			})
		}
	}
</script>

<style lang="scss" scoped>
	.setup {
		width: 100vw;
		height: 100vh;
		background-color: #f1f1f1;
		display: flex;
		flex-direction: column;
		align-items: center;

		.setup_menu {
			width: 96%;
			display: flex;
			flex-direction: column;

			.setup_item {
				background-color: #fff;
				font-size: 14px;
				padding: 20px;
				margin-top: 8px;
				border-radius: 8px;
			}
		}

		.layout {
			width: 40%;
			background-color: #884e22;
			color: #fff;
			line-height: 40px;
			text-align: center;
			border-radius: 20px;
			margin-top: 40px;
		}
	}
</style>